package com.yipin.neimeng.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.yipin.neimeng.util.HttpJsonInvokeDemo;

public class Test {
	public static void main(String[] args) throws Exception {
		HttpJsonInvokeDemo demo = new HttpJsonInvokeDemo();
		String pasm ="A8496681F2741534129C8EED3777F966B6AD9CE53D241123146017F51E4A150DF112F05E1D7F37ADCC2D5829408A139F2FB04E6EA37FB4F4B33386599DD7772445B5BC20922D2329694300DD8FDC32D9F7808F1D54C57C6BF7BAA3E3EA430510";
		String pub_key = "6b968fcf48a19c399090e99a52747c61";

		JSONObject reqJson = new JSONObject();
		JSONObject pubJson = new JSONObject();
		JSONObject pageJson = new JSONObject();

		pubJson.put("OP_CODE", "SYS71040800");
		pubJson.put("REQ_SERIAL_NO", "201609062155");
		pubJson.put("CHANNEL_ID", "25");
		pubJson.put("OP_ORG_ID", "10002268");

		pageJson.put("PAGE_SIZE", "2");
		pageJson.put("CURRENT_PAGE", "1");

		reqJson.put("PUB_INFO", pubJson);
		reqJson.put("PAGE_INFO", pageJson);

		// 业务参数,Json格式
		JSONObject busiJson = new JSONObject();
		busiJson.put("ACCESS_NUM", "17537296859");
		busiJson.put("BUSI_CODE", "0001");
		busiJson.put("OFFER_ID", "200555000525");
		busiJson.put("CHANNEL_NAME", "71012628");

		reqJson.put("BUSI_INFO", busiJson);

		JSONObject inputJson = new JSONObject();
		inputJson.put("REQ_PARAM", reqJson);

		String busiParam = inputJson.toString();
		String find = HttpJsonInvokeDemo.encryptMessage(busiParam,"1",pub_key,"AES");

		System.out.println("加密报文："+find);

		String aes = HttpJsonInvokeDemo.decryptMessage(find, "1", pub_key, "AES");
		System.out.println("解密："+aes);
//		String SS = "A8496681F2741534129C8EED3777F966B6AD9CE53D241123146017F51E4A150DF112F05E1D7F37ADCC2D5829408A139F2FB04E6EA37FB4F4B33386599DD7772445B5BC20922D2329694300DD8FDC32D9F7808F1D54C57C6BF7BAA3E3EA430510";
//		String s = HttpJsonInvokeDemo.decryptMessage(SS,"1","6b968fcf48a19c399090e99a52747c61","AES");
//		System.out.println(s);

	}
}
